(function(angular) {
	'use strict';
	angular.module("fs.waf").factory("currencyService", currencyService);
	currencyService.$inject = [ '$q', 'loggerFactory', 'ajaxServiceFactory' ];
	function currencyService($q, loggerFactory, ajaxServiceFactory) {
		var log = loggerFactory.getLogger("currencyService");
		var ajaxServices = ajaxServiceFactory.buildAjaxService({
			getCountryOptions : {
				url : 'do/cda/dataList/country',
				method : 'get'
			},
			getIntCalcBasisOptions: {
				url: 'do/cda/dataList/intcalcBasisOptions',
				method: 'get'
			},
			getDataStatus : {
				url : 'do/cda/dataList/dataStatus',
				method : 'get'
			}
		});	
		
		function getDataStatus() {
			var defer = $q.defer();
			ajaxServices.getDataStatus().then(function(response) {
				defer.resolve(response ? response.data : {});
			});
			return defer.promise;
		};
		
		function getCountryOptions() {
			var deferred = $q.defer();
			ajaxServices.getCountryOptions().then(function(response) {
				deferred.resolve({
					data : response ? response.data : {}
				});
			}, function(error) {
				deferred.reject(error);
			});
			return deferred.promise;
		}
		
		function getIntCalcBasisOptions() {
			var deferred = $q.defer();
			ajaxServices.getIntCalcBasisOptions().then(function(response) {
				deferred.resolve({
					data : response ? response.data : {}
				});
			}, function(error) {
				deferred.reject(error);
			});
			return deferred.promise;			
		}
		return {
			getCountryOptions: getCountryOptions,
			getIntCalcBasisOptions: getIntCalcBasisOptions,
			getDataStatus : getDataStatus
		};
	}
})(angular);